<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: july <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件
header("Content-type:text/html; charset=UTF-8");
 
// 分配客服
//$RoleID 客服角色ID
function kefu($RoleID){
    $where = [
            'RoleID' => $RoleID,               //角色ID
            'isjiqi' =>2,        //是否机器 1 是 2否
        ];
		
	$DShadminID=db('sys_administrator')->where($where)->column('ID'); //客服专员ID
	$count=count($DShadminID);
	if($count=='1'){
		return $DShadminID['0'];
	}else{
	 return $DShadminID[rand(0,$count-1)];
	}
}
